#include <system.h>
#include <nios2_irq.h>
#include <nios2_timer.h>
#include <nios2_led.h>
#include <io.h>
#include <console.h>
#include <nios2.h>
#include <clock.h>
#include <assert.h>
#include <sdram_test.h>
#include <proc.h>

int main (void) __attribute__ ((weak, alias ("alt_main")));


int alt_main(void)
{ 
    cons_init();                // init the console

    const char *message = "(THU.CST) os is loading ...";
    cprintf("%s\n\n", message);

    //sdram_test();               // test if sdram works
        
    pmm_init();                 // init physical memory management    

    vmm_init();                 // init virtual memory management
    
    proc_init();
        
    irq_init();                 // enable irq interrupt
    
    timer_init();               // init clock interrupt
    
    cpu_idle();                 // run idle process
    
    
    panic("alt_main ends\n");
}
